package models.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.ColumnResult;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
import javax.persistence.SqlResultSetMapping;
import javax.persistence.SqlResultSetMappings;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import models.enumtype.ActiveType;


@Entity
@Table(name = "STAFF")
public class Staff implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="STAFF_STAFFID_GENERATOR", sequenceName="STAFF_SEQ",allocationSize = 1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="STAFF_STAFFID_GENERATOR")
	@Column(name="STAFF_ID")
	private Long staffId;

	@Column(name="ADDRESS")
	private String address;

	@Column(name="AREA_CODE")
	private String areaCode;

	@Column(name="BIRTHDAY")
    @Temporal( TemporalType.DATE)
	private Date birthday;

	@Column(name="CAT_ID")
	private Long catId;

	@Column(name="CHANNEL_TYPE_ID")
	private Long channelTypeId;

	@Column(name="COUNTRY")
	private String country;

    @Temporal( TemporalType.DATE)
	@Column(name="CREATE_TIME")
	private Date createTime;

	@Column(name="CREATE_USER")
	private String createUser;

	@Column(name="DEVICE_IMEI")
	private String deviceImei;

	@Column(name="EDUCATION_ID")
	private String educationId;

	@Column(name="IS_DELETE_DATA")
	private Integer isDeleteData;

    @Temporal( TemporalType.DATE)
	@Column(name="LAST_APPROVE_ORDER")
	private Date lastApproveOrder;

    @Temporal( TemporalType.DATE)
	@Column(name="LAST_ORDER")
	private Date lastOrder;

    @Column(name="LOCKSTATUS")
	private Integer lockstatus;

	@Column(name="MAIL")
	private String mail;

	@Column(name="MOBILE")
	private String mobile;

	@Column(name="NAME")
	private String name;

	@Column(name="NAME_TEXT")
	private String nameText;

	@Column(name="NUMBER_LOGIN_FAIL")
	private Integer numberLoginFail;

	@Column(name="PASSWORD")
	private String password;

	@Column(name="PHONE")
	private String phone;

	@Column(name="PLAN")
	private Integer plan;

	@Column(name="POSITION_ID")
	private String positionId;

	@Column(name="RESET_THRESHOLD")
	private Integer resetThreshold;

	@Column(name="ROLE_TYPE")
	private Integer roleType;

	@Column(name="SEX")
	private Integer sex;

	@ManyToOne
	@JoinColumn(name="SHOP_ID")
	private Shop shop;

	@Column(name="SKU")
	private Integer sku;

	@Column(name="SKU_AMOUNT")
	private BigDecimal skuAmount;

	@Column(name="STAFF_CODE")
	private String staffCode;

	@ManyToOne
	@JoinColumn(name="STAFF_OWNER_ID")
	private Staff staffOwner;

	@Column(name="STAFF_TYPE")
	private String staffType;

    @Temporal( TemporalType.DATE)
	@Column(name="START_DATE")
	private Date startDate;

	@Basic
	@Column(name = "STATUS", columnDefinition = "integer", nullable = false)
	@Type(type = "models.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "models.enumtype.ActiveType"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	private ActiveType status = ActiveType.RUNNING ;

	@Column(name="STREET")
	private String street;

    @Temporal( TemporalType.DATE)
	@Column(name="UPDATE_PLAN")
	private Date updatePlan;

    @Temporal( TemporalType.DATE)
	@Column(name="UPDATE_TIME")
	private Date updateTime;

	@Column(name="UPDATE_USER")
	private String updateUser;
	
	//bi-directional one-to-one association to GCMRegistration
	@javax.persistence.OneToOne
	@JoinColumn(name="STAFF_ID", referencedColumnName="STAFF_ID")
	private GCMRegistration gcmRegistration;

	public Long getStaffId() {
		return staffId;
	}

	public void setStaffId(Long staffId) {
		this.staffId = staffId;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Long getCatId() {
		return catId;
	}

	public void setCatId(Long catId) {
		this.catId = catId;
	}

	public Long getChannelTypeId() {
		return channelTypeId;
	}

	public void setChannelTypeId(Long channelTypeId) {
		this.channelTypeId = channelTypeId;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getCreateUser() {
		return createUser;
	}

	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}

	public String getDeviceImei() {
		return deviceImei;
	}

	public void setDeviceImei(String deviceImei) {
		this.deviceImei = deviceImei;
	}

	public String getEducationId() {
		return educationId;
	}

	public void setEducationId(String educationId) {
		this.educationId = educationId;
	}

	public Integer getIsDeleteData() {
		return isDeleteData;
	}

	public void setIsDeleteData(Integer isDeleteData) {
		this.isDeleteData = isDeleteData;
	}

	public Date getLastApproveOrder() {
		return lastApproveOrder;
	}

	public void setLastApproveOrder(Date lastApproveOrder) {
		this.lastApproveOrder = lastApproveOrder;
	}

	public Date getLastOrder() {
		return lastOrder;
	}

	public void setLastOrder(Date lastOrder) {
		this.lastOrder = lastOrder;
	}

	public Integer getLockstatus() {
		return lockstatus;
	}

	public void setLockstatus(Integer lockstatus) {
		this.lockstatus = lockstatus;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNameText() {
		return nameText;
	}

	public void setNameText(String nameText) {
		this.nameText = nameText;
	}

	public Integer getNumberLoginFail() {
		return numberLoginFail;
	}

	public void setNumberLoginFail(Integer numberLoginFail) {
		this.numberLoginFail = numberLoginFail;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Integer getPlan() {
		return plan;
	}

	public void setPlan(Integer plan) {
		this.plan = plan;
	}

	

	public String getPositionId() {
		return positionId;
	}

	public void setPositionId(String positionId) {
		this.positionId = positionId;
	}

	public Integer getResetThreshold() {
		return resetThreshold;
	}

	public void setResetThreshold(Integer resetThreshold) {
		this.resetThreshold = resetThreshold;
	}

	public Integer getRoleType() {
		return roleType;
	}

	public void setRoleType(Integer roleType) {
		this.roleType = roleType;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public Integer getSku() {
		return sku;
	}

	public void setSku(Integer sku) {
		this.sku = sku;
	}

	public BigDecimal getSkuAmount() {
		return skuAmount;
	}

	public void setSkuAmount(BigDecimal skuAmount) {
		this.skuAmount = skuAmount;
	}

	public String getStaffCode() {
		return staffCode;
	}

	public void setStaffCode(String staffCode) {
		this.staffCode = staffCode;
	}

	public Staff getStaffOwner() {
		return staffOwner;
	}

	public void setStaffOwner(Staff staffOwner) {
		this.staffOwner = staffOwner;
	}

	public String getStaffType() {
		return staffType;
	}

	public void setStaffType(String staffType) {
		this.staffType = staffType;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public ActiveType getStatus() {
		return status;
	}

	public void setStatus(ActiveType status) {
		this.status = status;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public Date getUpdatePlan() {
		return updatePlan;
	}

	public void setUpdatePlan(Date updatePlan) {
		this.updatePlan = updatePlan;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}

	public GCMRegistration getGcmRegistration() {
		return gcmRegistration;
	}

	public void setGcmRegistration(GCMRegistration gcmRegistration) {
		this.gcmRegistration = gcmRegistration;
	}
}